package test1.impl;

import org.springframework.context.support.ClassPathXmlApplicationContext;

public class test {

    public static void main(String[] args) {
        //test1();
        test2();
    }

    //不使用spring的情况下
    public static void test1(){
        BookServiceImpl bookService = new BookServiceImpl();
        bookService.save();
    }


    //使用spring管理对象，实现ioc
    public static void test2(){
        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
        BookServiceImpl bs = ctx.getBean("BookService", BookServiceImpl.class);
        bs.save();
    }


}
